#include "L2DataSet.hpp"
#include "L2Configurator.hpp"
#include <iostream>
#include <cstring>

char *msg = "Test.string=\"Hello Leo.\"";
bool read_flag = false;

class FileAdapter : public Configurator::FileAdapter {
public:
    virtual bool open(int flag){
        return true;
    }

    virtual bool close(){
        return false;
    }

    virtual unsigned int readline(void *buffer){
        if ( !read_flag ){
            read_flag = true;
            strcpy((char*)buffer,msg);
            return strlen(msg);
        }else{
            return 0;
        }
    }

    virtual unsigned int writeline(void *buffer){
        return 0;
    }
};

int main(){
    FileAdapter file_adapter;
    Configurator configurator(&file_adapter);
    configurator.load();

    std::cout << configurator.getString("Test.string") << std::endl;
    return 0;
}